﻿using System.ComponentModel;
using CSW.Framework.Common;

namespace LinqBusinessObjectBuilder.ProjectInfo
{
    internal class DataProvider
    {
        private static readonly DataProvider m_SqlServer;
        private static readonly DataProvider m_SqlServerCe;
        private static readonly ReadOnlyBindingList<DataProvider> m_List;

        private readonly string m_Name;

        static DataProvider()
        {
            m_SqlServer = new DataProvider("SQL Server");
            m_SqlServerCe = new DataProvider("SQL Server CE");

            m_List = new ReadOnlyBindingList<DataProvider>
                         {
                             m_SqlServer, 
                             m_SqlServerCe
                         };

            m_List.MakeReadOnly();
        }

        private DataProvider(string name)
        {
            Guard.ArgumentNotNullOrEmptyString(name, "name");

            m_Name = name;
        }

        public string Name
        {
            get { return m_Name; }
        }

        public override string ToString()
        {
            return m_Name;
        }

        public static DataProvider SqlServer
        {
            get { return m_SqlServer; }
        }

        public static DataProvider SqlServerCe
        {
            get { return m_SqlServerCe; }
        }

        public static BindingList<DataProvider> GetAll()
        {
            return m_List;
        }
    }
}